MicroPython and the Internet of Things by Grinberg Miguel
Author:Grinberg, Miguel
Language: eng
Format: epub
Publisher: Softcover
Published: 2019-04-25T00:00:00+00:00
This function considers any response that comes back with a status code of 400 or higher as an error. Note how Iâm adding print() statements that provide information about whatâs going on in the application. These are obviously not going to be seen anywhere when you are running the device standalone, but the point of having them there is that you can also run these functions from the REPL, and in that case you will want to know what happens.
Here is an almost complete version of main.py with this application:
import network import time import urequests import config def connect_wifi(): ap_if = network.WLAN(network.AP_IF) ap_if.active(False) sta_if = network.WLAN(network.STA_IF) if not sta_if.isconnected(): print('Connecting to WiFi...') sta_if.active(True) sta_if.connect(config.WIFI_SSID, config.WIFI_PASSWORD) while not sta_if.isconnected(): time.sleep(1) print('Network config:', sta_if.ifconfig()) def call_webhook(): print('Invoking webhook') response = urequests.post(config.WEBHOOK_URL, json={'value1': config.BUTTON_ID}) if response.status_code < 400: print('Webhook invoked') else: print('Webhook failed')
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Whiskies Galore by Ian Buxton(41489)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32857)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32534)
Craft Beer for the Homebrewer by Michael Agnew(17902)
Turbulence by E. J. Noyes(7660)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7097)
Kaplan MCAT General Chemistry Review by Kaplan(6548)
The Thirst by Nesbo Jo(6406)
Bad Blood by John Carreyrou(6245)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6202)
Learning SQL by Alan Beaulieu(5995)
Weapons of Math Destruction by Cathy O'Neil(5779)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5593)
Digital Minimalism by Cal Newport;(5325)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5147)
iGen by Jean M. Twenge(5125)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4862)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4807)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4698)
